69 #define XMC_BCCU_NO_OF_CHANNELS (9U) 70 #define XMC_BCCU_CHANNEL_MASK ((0x1 << XMC_BCCU_NO_OF_CHANNELS)-1) 71 #define XMC_BCCU_NO_OF_DIM_ENGINE (3U) 72 #define XMC_BCCU_DIM_ENGINE_MASK (((0x1 << XMC_BCCU_NO_OF_DIM_ENGINE)-1)) 97 void XMC_BCCU_GlobalInit(XMC_BCCU_t *
const bccu,
const XMC_BCCU_GLOBAL_CONFIG_t *
const config)
101 bccu->GLOBCON = config->globcon;
103 bccu->GLOBCLK = config->globclk;
104 bccu->GLOBDIM = config->global_dimlevel;
111 void XMC_BCCU_ConfigGlobalTrigger(XMC_BCCU_t *
const bccu, XMC_BCCU_TRIGMODE_t mode, XMC_BCCU_TRIGDELAY_t
delay)
120 void XMC_BCCU_SelectTrapInput (XMC_BCCU_t *
const bccu, XMC_BCCU_CH_TRAP_IN_t input)
129 void XMC_BCCU_SetTrapEdge (XMC_BCCU_t *
const bccu, XMC_BCCU_CH_TRAP_EDGE_t edge)
138 void XMC_BCCU_ConfigSuspendMode (XMC_BCCU_t *
const bccu, XMC_BCCU_SUSPEND_MODE_t mode)
147 void XMC_BCCU_SetFlickerWDThreshold (XMC_BCCU_t *
const bccu, uint32_t threshold_no)
158 void XMC_BCCU_SetFastClockPrescaler (XMC_BCCU_t *
const bccu, uint32_t div)
163 bccu->GLOBCLK |= div;
170 void XMC_BCCU_SetDimClockPrescaler (XMC_BCCU_t *
const bccu, uint32_t div)
182 void XMC_BCCU_SelectBitClock (XMC_BCCU_t *
const bccu, XMC_BCCU_BCLK_MODE_t div)
191 void XMC_BCCU_ConcurrentEnableChannels (XMC_BCCU_t *
const bccu, uint32_t mask)
193 XMC_ASSERT(
"XMC_BCCU_ConcurrentEnableChannels: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK));
201 void XMC_BCCU_ConcurrentDisableChannels (XMC_BCCU_t *
const bccu, uint32_t mask)
203 XMC_ASSERT(
"XMC_BCCU_ConcurrentDisableChannels: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK));
204 bccu->CHEN &= ~(uint32_t)(mask);
210 void XMC_BCCU_ConcurrentSetOutputPassiveLevel(XMC_BCCU_t *
const bccu, uint32_t chan_mask, XMC_BCCU_CH_ACTIVE_LEVEL_t level)
212 XMC_ASSERT(
"XMC_BCCU_ConcurrentSetOutputPassiveLevel: Invalid channel mask", (chan_mask <= XMC_BCCU_CHANNEL_MASK));
214 bccu->CHOCON &= ~(uint32_t)(chan_mask);
215 bccu->CHOCON |= (chan_mask * (uint32_t)level);
221 void XMC_BCCU_ConcurrentEnableTrap (XMC_BCCU_t *
const bccu, uint32_t mask)
223 XMC_ASSERT(
"XMC_BCCU_ConcurrentEnableTrap: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK));
231 void XMC_BCCU_ConcurrentDisableTrap (XMC_BCCU_t *
const bccu, uint32_t mask)
233 XMC_ASSERT(
"XMC_BCCU_ConcurrentDisableTrap: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK));
241 void XMC_BCCU_ConcurrentConfigTrigger (XMC_BCCU_t *
const bccu, XMC_BCCU_TRIG_CONFIG_t *trig)
245 XMC_ASSERT(
"XMC_BCCU_ConcurrentConfigTrigger: Invalid channel mask", (trig->mask_chans <= XMC_BCCU_CHANNEL_MASK));
250 reg |= trig->mask_chans;
258 void XMC_BCCU_ConcurrentStartLinearWalk (XMC_BCCU_t *
const bccu, uint32_t mask)
260 XMC_ASSERT(
"XMC_BCCU_ConcurrentStartLinearWalk: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK));
262 bccu->CHSTRCON |= (uint32_t)(mask);
268 void XMC_BCCU_ConcurrentAbortLinearWalk (XMC_BCCU_t *
const bccu, uint32_t mask)
270 XMC_ASSERT(
"XMC_BCCU_ConcurrentAbortLinearWalk: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK));
278 void XMC_BCCU_ConcurrentEnableDimmingEngine (XMC_BCCU_t *
const bccu, uint32_t mask)
280 XMC_ASSERT(
"XMC_BCCU_ConcurrentEnableDimmingEngine: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK));
282 bccu->DEEN = (uint32_t)(mask);
288 void XMC_BCCU_ConcurrentDisableDimmingEngine (XMC_BCCU_t *
const bccu, uint32_t mask)
290 XMC_ASSERT(
"XMC_BCCU_ConcurrentDisableDimmingEngine: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK));
292 bccu->DEEN &= ~(uint32_t)(mask);
298 void XMC_BCCU_ConcurrentStartDimming (XMC_BCCU_t *
const bccu, uint32_t mask)
300 XMC_ASSERT(
"XMC_BCCU_ConcurrentStartDimming: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK));
302 bccu->DESTRCON = (uint32_t)(mask);
308 void XMC_BCCU_ConcurrentAbortDimming (XMC_BCCU_t *
const bccu, uint32_t mask)
310 XMC_ASSERT(
"XMC_BCCU_ConcurrentAbortDimming: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK));
318 void XMC_BCCU_SetGlobalDimmingLevel (XMC_BCCU_t *
const bccu, uint32_t level)
322 bccu->GLOBDIM = level;
328 void XMC_BCCU_EnableChannel (XMC_BCCU_t *
const bccu, uint32_t chan_no)
330 XMC_ASSERT(
"XMC_BCCU_EnableChannel: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1)));
338 void XMC_BCCU_DisableChannel (XMC_BCCU_t *
const bccu, uint32_t chan_no)
340 XMC_ASSERT(
"XMC_BCCU_DisableChannel: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1)));
348 void XMC_BCCU_SetOutputPassiveLevel(XMC_BCCU_t *
const bccu, uint32_t chan_no, XMC_BCCU_CH_ACTIVE_LEVEL_t level)
350 XMC_ASSERT(
"XMC_BCCU_SetOutputPassiveLevel: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1)));
352 bccu->CHOCON |= ((uint32_t)level << chan_no);
358 void XMC_BCCU_EnableTrap (XMC_BCCU_t *
const bccu, uint32_t chan_no)
360 XMC_ASSERT(
"XMC_BCCU_EnableTrap: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1)));
368 void XMC_BCCU_DisableTrap (XMC_BCCU_t *
const bccu, uint32_t chan_no)
370 XMC_ASSERT(
"XMC_BCCU_DisableTrap: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1)));
378 void XMC_BCCU_EnableChannelTrigger (XMC_BCCU_t *
const bccu, uint32_t chan_no, XMC_BCCU_CH_TRIGOUT_t trig_line)
381 XMC_ASSERT(
"XMC_BCCU_EnableChannelTrigger: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1)));
392 void XMC_BCCU_DisableChannelTrigger (XMC_BCCU_t *
const bccu, uint32_t chan_no)
394 XMC_ASSERT(
"XMC_BCCU_DisableChannelTrigger: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1)));
402 void XMC_BCCU_CH_Init (XMC_BCCU_CH_t *
const channel,
const XMC_BCCU_CH_CONFIG_t *
const config)
404 channel->CHCONFIG = config->chconfig;
406 channel->PKCMP = config->pkcmp;
408 channel->PKCNTR = config->pkcntr;
414 void XMC_BCCU_CH_ConfigTrigger (XMC_BCCU_CH_t *
const channel, XMC_BCCU_CH_TRIG_EDGE_t edge, uint32_t force_trig_en)
421 channel->CHCONFIG |= reg;
427 void XMC_BCCU_CH_SetLinearWalkPrescaler (XMC_BCCU_CH_t *
const channel, uint32_t clk_div)
436 void XMC_BCCU_CH_SetTargetIntensity (XMC_BCCU_CH_t *
const channel, uint32_t ch_int)
438 channel->INTS = ch_int;
444 uint32_t XMC_BCCU_CH_ReadIntensity (XMC_BCCU_CH_t *
const channel)
452 void XMC_BCCU_CH_EnablePacker (XMC_BCCU_CH_t *
const channel, uint32_t thresh, uint32_t off_comp, uint32_t on_comp)
455 channel->CHCONFIG |= thresh;
463 void XMC_BCCU_CH_SetPackerThreshold (XMC_BCCU_CH_t *
const channel, uint32_t val)
466 channel->CHCONFIG |= val;
472 void XMC_BCCU_CH_SetPackerOffCompare (XMC_BCCU_CH_t *
const channel, uint32_t level)
475 channel->PKCMP |= level;
481 void XMC_BCCU_CH_SetPackerOnCompare (XMC_BCCU_CH_t *
const channel, uint32_t level)
490 void XMC_BCCU_CH_DisablePacker (XMC_BCCU_CH_t *
const channel)
498 void XMC_BCCU_CH_SetPackerOffCounter (XMC_BCCU_CH_t *
const channel, uint32_t cnt_val)
501 channel->PKCNTR |= cnt_val;
507 void XMC_BCCU_CH_SetPackerOnCounter (XMC_BCCU_CH_t *
const channel, uint32_t cnt_val)
516 void XMC_BCCU_CH_SelectDimEngine (XMC_BCCU_CH_t *
const channel, XMC_BCCU_CH_DIMMING_SOURCE_t sel)
526 void XMC_BCCU_CH_EnableDimmingBypass (XMC_BCCU_CH_t *
const channel)
535 void XMC_BCCU_CH_DisableDimmingBypass (XMC_BCCU_CH_t *
const channel)
543 void XMC_BCCU_DIM_Init (XMC_BCCU_DIM_t *
const dim_engine,
const XMC_BCCU_DIM_CONFIG_t *
const config)
545 dim_engine->DTT = config->dtt;
551 void XMC_BCCU_DIM_SetTargetDimmingLevel (XMC_BCCU_DIM_t *
const dim_engine, uint32_t level)
553 dim_engine->DLS = level;
559 void XMC_BCCU_DIM_SetDimDivider (XMC_BCCU_DIM_t *
const dim_engine, uint32_t div)
562 dim_engine->DTT |= div;
568 void XMC_BCCU_DIM_ConfigDimCurve (XMC_BCCU_DIM_t *
const dim_engine, uint32_t dither_en, XMC_BCCU_DIM_CURVE_t sel)
574 dim_engine->DTT |= reg;
#define BCCU_CHOCON_CH0TPE_Pos
#define BCCU_CH_PKCMP_ONCMP_Msk
#define BCCU_GLOBCON_WDMBN_Msk
#define BCCU_CH_CHCONFIG_ENFT_Pos
#define BCCU_CH_CHCONFIG_PEN_Msk
#define BCCU_GLOBCLK_DCLK_PS_Msk
#define BCCU_DE_DTT_CSEL_Pos
#define BCCU_CHOCON_CH0TPE_Msk
#define BCCU_GLOBCON_TRAPIS_Msk
void XMC_SCU_CLOCK_UngatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral)
#define BCCU_CH_PKCNTR_ONCNTVAL_Pos
#define BCCU_CH_CHCONFIG_ENFT_Msk
#define BCCU_DE_DTT_DTEN_Pos
#define BCCU_DE_DTT_DTEN_Msk
#define BCCU_GLOBCON_SUSCFG_Msk
#define BCCU_DE_DTT_CSEL_Msk
#define BCCU_CH_CHCONFIG_PKTH_Msk
#define BCCU_DE_DTT_DIMDIV_Msk
#define BCCU_GLOBCLK_FCLK_PS_Msk
#define XMC_ASSERT(msg, exp)
#define BCCU_CHTRIG_TOS0_Msk
#define BCCU_CHSTRCON_CH0A_Pos
#define BCCU_GLOBCON_TRDEL_Msk
#define BCCU_GLOBCON_TRAPED_Msk
#define BCCU_GLOBDIM_GLOBDIM_Msk
#define BCCU_CH_CHCONFIG_LINPRES_Pos
#define BCCU_GLOBCON_TM_Msk
#define BCCU_CH_INT_CHINT_Msk
#define BCCU_DESTRCON_DE0A_Pos
#define BCCU_CH_CHCONFIG_DSEL_Pos
#define BCCU_CH_CHCONFIG_TRED_Pos
#define BCCU_GLOBCON_TRAPED_Pos
#define BCCU_CH_PKCMP_ONCMP_Pos
#define BCCU_CH_CHCONFIG_DBP_Msk
#define BCCU_CHEN_ECH0_Msk
#define BCCU_GLOBCON_WDMBN_Pos
#define BCCU_CHTRIG_TOS0_Pos
#define BCCU_CH_CHCONFIG_LINPRES_Msk
#define BCCU_CH_CHCONFIG_TRED_Msk
#define BCCU_GLOBCON_SUSCFG_Pos
#define BCCU_CHTRIG_ET0_Msk
#define BCCU_GLOBCLK_BCS_Msk
#define BCCU_GLOBCON_TRDEL_Pos
#define BCCU_GLOBCLK_DCLK_PS_Pos
#define BCCU_CH_CHCONFIG_DSEL_Msk
#define BCCU_GLOBCLK_BCS_Pos
#define BCCU_CH_PKCNTR_OFFCNTVAL_Msk
#define BCCU_CH_PKCNTR_ONCNTVAL_Msk
#define BCCU_GLOBCON_TRAPIS_Pos
#define BCCU_CH_PKCMP_OFFCMP_Msk
static void delay(uint32_t cycles)